<?php

namespace App\model;

use support\Model;
use Illuminate\Support\Traits;

class GameLog extends Model
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'game_log';

    /**
     * The primary key associated with the table.
     *
     * @var string
     */
    protected $primaryKey = 'id';

    /**
     * Indicates if the model should be timestamped.
     *
     * @var bool
     */
    public $timestamps = true;

    protected $dateFormat = 'U';

    protected $guarded = [];

    protected $casts = [
        // 'created_at' => 'datetime:Y-m-d H:i:s',
        // 'updated_at' => 'datetime:Y-m-d H:i:s',
        'ext' => 'json',
        'attach' => 'json',
    ];

    public function getCreatedAtAttribute($value)
    {
        $value = is_string($value) ? strtotime($value) : $value;
        return date('Y-m-d H:i:s', $value);
    }

}
